#ifndef SLANEDIT_H
#define SLANEDIT_H

#include <QMainWindow>
#include "slaneditwidget.h"
#include "slanProjectFileDock.h"
#include "slandirfiledock.h"

class QMenu;
class QAction;
class QMdiArea;



class SlanEdit : public QMainWindow
{
    Q_OBJECT

public:
    SlanEdit(QWidget *parent = 0);


private:

    void createWidgets();       //创建部件
    void createMenuBar();       //创建菜单
    void createToolBar();       //创建工具栏
    void createStatusBar();     //创建状态栏
    void createMdiWidgets();    //创建MDI
    void createDockWdiget();//创建项目停靠窗口


    void readSettings();        //读取设置
    void writeSettings();       //写入设置

    //管理各个菜单的Action
    void insertFileAction();        //文件菜单功能
    void insertEditAction();        //编辑菜单功能
    void insertWindowAction();      //窗口菜单功能
    void insertHelpAction();        //帮助菜单功能

    //管理各个菜单的内容
    void insertFileMenu();          //文件菜单内容
    void insertEditMenu();          //编辑菜单内容
    void insertWindowMenu();        //窗口菜单内容
    void insertHelpMenu();          //帮助菜单内容



    SlanEditWidget * createSlanEditWidget();    //创建多文档界面
//    void addSlanEditerWidget(SlanEditWidget*);

    void updateActions();   //更新部件的状态

    SlanEditWidget *activeSlanEditWidget() const;   //查找安全选中的窗口

public slots:
    void slotOpenFile();
    void slotOpenFile(const QString &);
    void slotNewProjectFile();
    void slotOpenProjectFile();
    void slotNewFile();
    void slotSaveFile();
    void slotSaveAsFile();

    void slotUndo();
    void slotRedo();
    void slotCut();
    void slotCopy();
    void slotPaste();


protected:
    void closeEvent(QCloseEvent *event);

private:
    //FILE
    QAction * newFileAct;
    QAction * openFileAct;
    QAction * newProjectAct;
    QAction * openProjectAct;
    QAction * saveFileAct;
    QAction * saveAsFileAct;
    QAction * closeFileAct;
    QAction * closeAllFileAct;
    QAction * exitSoftWareAct;

    //Edit
    QAction * redoAct;
    QAction * undoAct;
    QAction * cutAct;
    QAction * copyAct;
    QAction * pasteAct;

    //菜单
    QMenu * fileMenu;
    QMenu * projectMenu;
    QMenu * editMenu;
    QMenu * WindowMenu;
    QMenu * helpMenu;

    QMdiArea* mdiArea;  //MDI主部件
    SlanEditWidget * activeEditWidget;//当前活跃窗口
    SlanProjectFileDock *projectFileDockWidget;
    SlanDirFileDock * dirFileDockWidget;


};

#endif // SLANEDIT_H
